/**
 * 功能描述 导航栏
 */

define(function (require, exports, module) {
	var Subnav = require("subnav");
	var events = require("../handler/events");
	
    var instance = {
        initComponent:function (params,widget){
        	var isToDetail = true;
        	if(params && params.source == "CheckInSignUp"){
        		isToDetail = false;
        	}
        	
        	var subnav=new Subnav({
        		parentNode:".J-roompanorama-subnav",
        		model:{
            		title:"房态全景",
            		items:[{
        	            id: "building",
        	            type: "buttongroup",
        	            tip:"楼宇",
        	            lazy: true,
        	            keyField: "pkOrgBuilding",
        	            valueField: "name",
        	            url:"api/orgbuilding/getuserorgbuilding",
        	            params:{
        	            	fetchProperties:"pkOrgBuilding,name"
        	            },
        	            handler:function(key,element){
        	            	events.loadRoomType(widget,key);
        	            	events.setData(widget.get("curStatus"),widget);
        	            }
        	        
            		},{
        	            id: "roomType",
        	            type: "buttongroup",
        	            tip:"房型",
        	            keyField: "pkRoomType",
        	            valueField: "name",
        	            all: {
        	                show: true,
        	                text: "全部"
        	            },
        	            handler:function(key,element){
        	            	events.setData(widget.get("curStatus"),widget);
        	            }
            		},{
        	            id: "toDetail",
        	            type: "button",
        	            text: "在住预约统计",
        	            show:isToDetail,
        	            handler:function(key,element){
        	            	widget.openView({
        						url:"eling/elcms/travel/livebookstatistics/src/livebookstatistics_main",
        						params:{
        							type:"roompanorama"
        						},
        						isAllowBack:true
        					});
        	            }
            		
            		}]
        		}
        	});
        	widget.set("subnav",subnav);

        }
    };
    module.exports = instance;
});
